//
//  LSZAudioMyMusicViewController.m
//  JKFuYinProject
//
//  Created by 九酷 on 2018/7/3.
//  Copyright © 2018年 LC. All rights reserved.
//

#import "LSZAudioMyMusicViewController.h"

@interface LSZAudioMyMusicViewController ()<UITableViewDelegate,UITableViewDataSource>
{
    NSArray * arrayMusic;
}
@property(nonatomic,strong) UITableView * tableViewMusic;
@end

@implementation LSZAudioMyMusicViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"我的音乐";
    _tableViewMusic = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight) style:UITableViewStylePlain];
    _tableViewMusic.delegate = self;
    _tableViewMusic.dataSource = self;
    _tableViewMusic.separatorColor = divider;
    _tableViewMusic.separatorInset = UIEdgeInsetsMake(0, 20, 0, 20);
    _tableViewMusic.estimatedRowHeight =0;
    _tableViewMusic.estimatedSectionFooterHeight =0;
    _tableViewMusic.estimatedSectionHeaderHeight =0;
    [_tableViewMusic setSeparatorStyle:UITableViewCellSeparatorStyleNone];
    [self.view  addSubview:_tableViewMusic];
    [_tableViewMusic registerClass:[LSZMyHeaderCell class] forCellReuseIdentifier:@"LSZMyHeaderCell"];
    arrayMusic = @[@"已下载",@"收藏"];
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 2;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (ScreenWidth == 320) {
        //5
        return 45;
    }else if(ScreenWidth == 375){
        // 6 7
        return 50;
    }else {
        //plus
        return 58;
    }
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    LSZMyHeaderCell * cell = [tableView dequeueReusableCellWithIdentifier:@"LSZMyHeaderCell" forIndexPath:indexPath];

    cell.labelTitle.text = [NSString stringWithFormat:@"%@",arrayMusic[indexPath.row]];
    cell.labelExplain.hidden = YES;
    cell.imageViewIcon.hidden = YES;
    CGRect rect = cell.labelTitle.frame;
    rect.origin.x = cell.labelTitle.origin.x-10;
    cell.labelTitle.frame = rect;
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if ([arrayMusic[indexPath.row] isEqualToString:@"已下载"]) {
        LSZDownloadVC *viewController = [[LSZDownloadVC alloc] init];
        viewController.title = @"已下载";
        [self.navigationController pushViewController:viewController animated:YES];
    }
    if ([arrayMusic[indexPath.row] isEqualToString:@"收藏"]) {
        LSZAudioCollectionViewController * vc = [[LSZAudioCollectionViewController alloc]init];
        vc.uid = @"";
        [self.navigationController pushViewController:vc animated:YES];
    }
}
@end
